/*
package com.shiku.payment.service.impl;

import com.shiku.im.comm.constants.KConstants;
import com.shiku.im.pay.constants.ConsumeRecordEnum;
import com.shiku.im.pay.dao.ConsumeRecordDao;
import com.shiku.im.pay.entity.BaseConsumeRecord;
import com.shiku.payment.api.IPaymentNoticeApiService;
import com.shiku.payment.api.impl.AbstractPaymentNoticeService;
import com.shiku.payment.constant.PayConstant;
import com.shiku.payment.dto.PaySuccessDTO;
import com.shiku.payment.service.PayStrategyService;
import com.shiku.utils.DateUtil;
import com.shiku.utils.Money;
import com.shiku.utils.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.client.producer.SendStatus;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.MessagingException;
import org.springframework.stereotype.Service;

import java.util.Map;

@Slf4j
@Service
public  class PaymentNoticeServiceImpl extends AbstractPaymentNoticeService implements IPaymentNoticeApiService {


    @Autowired
    private RocketMQTemplate rocketMQTemplate;




    */
/**
     * 订单支付成功通知
     *//*

    private final String PAY_SUCCESS_NOTIFY="orderPaySuccessNotify";


    */
/**
     * 订单商家完成入账通知
     *//*

    private final String ORDER_END_NOTIFY = "orderEndNotify";

    @Autowired
    protected ConsumeRecordDao consumeRecordDao;


    */
/**
     * 订单支付成功发送通知到业务层
     *
     * @param successDTO
     * @return
     *//*

    @Override
    public boolean paySuccessNotify(PaySuccessDTO successDTO) {

        try {

            if(PayConstant.PAY_CHANNEL_ALIPAY.equals(successDTO.getChannelId())){
                //创建消费记录
                BaseConsumeRecord record=new BaseConsumeRecord();
                if(!StringUtil.isEmpty(successDTO.getUserId())){
                    record.setUserId(Integer.parseInt(successDTO.getUserId()));
                }
                record.setTradeNo(successDTO.getMchOrderNo());
                record.setMoney(Money.fromCentToDouble(successDTO.getAmount()));
                record.setBusinessId(successDTO.getMchOrderNo());

                record.setStatus(KConstants.OrderStatus.END);
                record.setType(ConsumeRecordEnum.MALL_ORDER_PAY.getType());
                record.setChangeType(KConstants.MOENY_REDUCE);

                record.setDesc("商城付款");
                record.setTime(DateUtil.currentTimeSeconds());
                record.setPayType(KConstants.PayType.ALIPAY);

                consumeRecordDao.addConsumRecord(record);
            }else if(PayConstant.PAY_CHANNEL_WXPAY.equals(successDTO.getChannelId())){
                //创建消费记录
                BaseConsumeRecord record=new BaseConsumeRecord();
                if(!StringUtil.isEmpty(successDTO.getUserId())){
                    record.setUserId(Integer.parseInt(successDTO.getUserId()));
                }

                record.setTradeNo(successDTO.getMchOrderNo());
                record.setMoney(Money.fromCentToDouble(successDTO.getAmount()));
                record.setBusinessId(successDTO.getMchOrderNo());

                record.setStatus(KConstants.OrderStatus.END);
                record.setType(ConsumeRecordEnum.MALL_ORDER_PAY.getType());
                record.setChangeType(KConstants.MOENY_REDUCE);

                record.setDesc("商城付款");
                record.setTime(DateUtil.currentTimeSeconds());
                record.setPayType(KConstants.PayType.WXPAY);
                consumeRecordDao.addConsumRecord(record);

            }





            log.info("订单支付成功通知 发送通知到订单系统 {} ",successDTO.getPayOrderId());
            SendResult sendResult = rocketMQTemplate.syncSend(PAY_SUCCESS_NOTIFY, successDTO.toString());
            if(SendStatus.SEND_OK!=sendResult.getSendStatus()){
                log.info("发送通知失败 {}  businessId {} payOrderId {}",successDTO.getMchOrderNo(),successDTO.getPayOrderId());
            }
            return true;
        } catch (Exception e) {
            log.error(e.getMessage(),e);
            return false;
        }


    }
	
    public boolean orderEndNotify(String businessId){
        try {
            log.info("订单完成入账通知，发送通知到订单系统 {}",businessId);
            SendResult sendResult = rocketMQTemplate.syncSend(ORDER_END_NOTIFY,businessId);
            if(SendStatus.SEND_OK!=sendResult.getSendStatus()){
                log.info("发送通知失败，businessId {}",businessId);
            }
            return true;
        }catch (Exception e){
            log.error(e.getMessage(),e);
            return false;
        }
    }
}
*/
